package ika.proj;

import com.jhlabs.map.proj.*;
import ika.proj.MapMath;
import java.awt.geom.*;

/**
 * Miller's second cylindrical projection, which is not used as often as his
 * first one. Very similar to Braun's cylindrical stereographic projection.
 * @author Bernhard Jenny, Institute of Cartography, ETH Zurich.
 */
public class MillerCylindricalIIProjection extends CylindricalProjection {

	public MillerCylindricalIIProjection() {
	}
	
	public Point2D.Double project(double lplam, double lpphi, Point2D.Double out) {
		out.x = lplam;
		out.y = Math.log(Math.tan(MapMath.QUARTERPI + lpphi / 3.)) * 1.5;
		return out;
	}

	public Point2D.Double projectInverse(double xyx, double xyy, Point2D.Double out) {
		out.x = xyx;
		out.y = 2.5 * (Math.atan(Math.exp(.8 * xyy)) - MapMath.QUARTERPI);
		return out;
	}

	public boolean hasInverse() {
		return true;
	}

	public String toString() {
		return "Miller Cylindrical II";
	}

}
